
package com.kkd.kkdapp.adapter;

import java.util.ArrayList;

import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.RelativeLayout;

public class ViewPagerAadapter extends PagerAdapter {
    ArrayList<RelativeLayout> tips;

    public ViewPagerAadapter(ArrayList<RelativeLayout> tips) {
        this.tips = tips;
    }

    @Override
    public int getCount() {

        return tips.size();
    }

    @Override
    public boolean isViewFromObject(View arg0, Object arg1) {

        return arg0 == arg1;

    }

    @Override
    public void destroyItem(View container, int position, Object object) {

        ((ViewPager) container).removeView(tips.get(position));

    }

    @Override
    public Object instantiateItem(View container, int position) {

        ((ViewPager) container).addView(tips.get(position));

        return tips.get(position);
    }

}
